import request from '../utils/request';

/**
 * 根据项目id获取对应数据
 * @param {*} id
 */
const getById = id => request({
  url: `/v1/project/${id}`,
  method: 'get'
});

/**
 * 获取分页项目数据
 * @param {*} params
 */
const getPage = params => request({
  url: '/v1/project/page',
  method: 'get',
  params
});

/**
 * 新增项目
 * @param {*} data
 */
const create = data => request({
  url: '/v1/project',
  method: 'post',
  data
});

/**
 * 修改项目
 * @param {*} data
 */
const modify = data => request({
  url: `/v1/project/${data.Id}`,
  method: 'put',
  data
});

/**
 * 更新项目状态
 * @param {*} id
 * @param {*} status
 */
const modifyStatus = (id, status) => request({
  url: `/v1/project/${id}/status`,
  method: 'put',
  params: { status }
});

// 获取项目整体信息
const getMainInfo = params => request({
  url: `/v1/project/analysis/${params.id}/list`,
  method: 'get',
  params: params
});
// 获取项目整体信息
const getAnalysis= params => request({
  url: `/v1/project/analysis/all/list`,
  method: 'get',
  params: params
});
export default {
  getById,
  getPage,
  create,
  modify,
  modifyStatus,
  getMainInfo,
  getAnalysis
}
